@extends('user.base.index')
@section('sidebar')
@stop

@section('content')
    <!-- Responsive Table -->
    <h4 class="page-title">推荐商品管理</h4>
    <div class="block-area" id="responsiveTable">
        <h3 class="block-title">推荐商品表</h3>
        <form action='/admin/recommend' method='post' name='myform'>
            <input type='hidden' name='_token' value='{{ csrf_token() }}'>
            <input type="hidden" name='_method' value='DELETE'>
        </form>
        <form action='/admin/recommend' method='get'>
            <div class='media-body'>
                商品名称：<input type='text' class='form-control m-b-5' name='name'>
            </div>
            <input type='submit' class='btn' value='搜索'>
        </form>
        <div class="table-responsive overflow">
            <table class="table tile">
                <thead>
                    <tr>
                        <th>No.</th>
                        <th>产品ID</th>
                        <th>商品名称</th>
                        <th>商品图片</th>
                        <th>商品价格</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                @foreach ($list as $v)
                    <tr>
                        <td>{{ $v->id }}</td>
                        <td>{{ $v->product_id }}</td>
                        <td>{{ $v->name}}</td>
                        <td><img src="{{ asset('images').'/'.$v->picture }}" width="50px"></td>
                        <td>{{ $v->lower_price }}</td>
                        <td>
                            <a href="javascript:doDel({{$v->id}})" class='btn'>删除</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            {{ $list->links() }}
            <script type="text/javascript">
            function doDel(id)
            {
                if(confirm('确定要删除么？')){
                    var form = document.myform;
                    form.action = '/admin/recommend/'+id;
                    form.submit();
                }
            }
        </script>
        </div>
    </div>
@stop

